package com.esd.controller.csair;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.esd.csair.ChangeDate;
import com.esd.csair.Csair;
import com.esd.csair.CsairImpl;
import com.esd.csair.CsairReturnValue;
import com.esd.csair.Passenger;

/**
 * 
 * 支付模块
 * 
 * @author snailzhang
 * @date 2017年7月20日
 *
 */
@Controller
@RequestMapping(value = "cs")
public class CsPayController {

	
	private static Logger log = Logger.getLogger(CsPayController.class);
	
	@RequestMapping(value = "queryOrderEx", method = RequestMethod.POST)
	@ResponseBody
	public String queryOrderEX(HttpServletRequest request, HttpSession session) {
		log.info("=======================查询订单==============================");
		String pageNum = request.getParameter("page");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		Map<String,Object> map = new HashMap<>();
		map = webClient.queryPlaneOrders(pageNum);
		return JSON.toJSONString(map);

	}
	
	/**
	 * 查询订单
	 * 
	 * @param session
	 * @return 2017年7月20日
	 */
	@RequestMapping(value = "queryOrder", method = RequestMethod.GET)
	public ModelAndView queryOrder() {
		return new ModelAndView("csair/orderQuery3");
	}
	

	/**
	 * 订单明细
	 */
	@RequestMapping(value = "OrderMX", method = RequestMethod.GET)
	public ModelAndView OrderMX(HttpServletRequest request,HttpSession session){
		log.info("================查看订单详情======================");
		Map<String , Object> map = new HashMap<String, Object>();
		String orderNum = request.getParameter("orderNum");
//		log.ingo("订单号=====>"+orderNum);
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.OrderMX(orderNum);
//		log.ingo("00000000");
		return new ModelAndView("csair/orderMX",map) ;
	}
	
	/**
	 * 变更明细
	 */
	@RequestMapping(value = "changeListMX", method = RequestMethod.GET)
	public ModelAndView changeListMX(HttpServletRequest request,HttpSession session){
		log.info("================查看订单详情======================");
		Map<String , Object> map = new HashMap<String, Object>();
		String orderno = request.getParameter("orderno");
		String changeno = request.getParameter("changeno");
		String changetype = request.getParameter("changetype");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.changeListMX(orderno,changeno,changetype);
		return new ModelAndView("csair/changeListMX",map) ;
	}
	
	/**
	 * 退票明细
	 */
	@RequestMapping(value = "refundListMX", method = RequestMethod.GET)
	public ModelAndView refundListMX(HttpServletRequest request,HttpSession session){
		log.info("================查看订单详情======================");
		Map<String , Object> map = new HashMap<String, Object>();
		String refundno = request.getParameter("refundno");
		String status = request.getParameter("status");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.refundListMX(refundno,status);
		return new ModelAndView("csair/refundListMX",map) ;
	}
	
	

	/**
	 * 加载支付页面
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "payOrder", method = RequestMethod.GET)
	public ModelAndView goPayPage(HttpServletRequest request, HttpSession session) {
		log.info("=================加载支付页面====================");
		Map<String, Object> map = new HashMap<String, Object>();
		String orderNo = request.getParameter("orderNo");
		String chuliTime1 = request.getParameter("chuliTime1");
		String nanhangTime1 = request.getParameter("nanhangTime1");
		String chuliTime2 = request.getParameter("chuliTime2");
		String nanhangTime2 = request.getParameter("nanhangTime2");
//		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
//		map = webClient.goPayPage(orderNo);
		map.put("orderNo", orderNo);
		map.put("chuliTime1", chuliTime1);
		map.put("nanhangTime1", nanhangTime1);
		map.put("chuliTime2", chuliTime2);
		map.put("nanhangTime2", nanhangTime2);
		return new ModelAndView("csair/pay2", map);
	}
	

	/**
	 * 加载支付页面订单信息
	 */
	@RequestMapping(value = "loadPayFilightInfo", method = RequestMethod.GET)
	public ModelAndView loadPayFilightInfo(HttpSession session, HttpServletRequest request) {
		log.info("===================加载支付页面订单信息===================");
		String orderNo = request.getParameter("orderNo");
		String chuliTime1 = request.getParameter("chuliTime1");
		String nanhangTime1 = request.getParameter("nanhangTime1");
		String chuliTime2 = request.getParameter("chuliTime2");
		String nanhangTime2 = request.getParameter("nanhangTime2");
		log.info("orderNo====>"+orderNo);
		log.info("chuliTime1====>"+chuliTime1);
		log.info("nanhangTime1====>"+nanhangTime1);
		log.info("chuliTime2====>"+chuliTime2);
		log.info("nanhangTime2====>"+nanhangTime2);
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		Map<String , Object> map = webClient.goPayPage(orderNo);
		if(map == null || map.get("nanhangTime3") == null || map.get("chuliTime3") == null  ){
			log.info("页面加载时间存在null!");
			Map<String , Object> map1 = new HashMap<String, Object>();
			map1.put("Time3","网络速度慢，请重新操作！");
			return new ModelAndView("csair/payFlightInfo2", map1);
		}
		double nanhangTime3 = (double) map.get("nanhangTime3");
		double chuliTime3 = (double) map.get("chuliTime3");
		map.put("Time1","无障碍处理旅客信息页面填写内容,跳转支付链接用时:"+ chuliTime1+"s,等待南航官网返回成功状态用时:"+nanhangTime1+"s");
		map.put("Time2","等待南航官网加载订单详情用时:"+ nanhangTime2+"s,无障碍获取订单号用时:"+chuliTime2+"s");
		map.put("Time3","等待南航官网加载支付页用时:"+ nanhangTime3+"s,无障碍处理用时:"+chuliTime3+"s");
		return new ModelAndView("csair/payFlightInfo2", map);
	}
	
	/**
	 * 订单支付页面借记卡获取验证码
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "payOrderYzm", method = RequestMethod.POST)
	@ResponseBody
	public CsairReturnValue yzmClick(HttpServletRequest request, HttpSession session) {
		log.info("=================借记卡获取验证码===================");
		String accountNo = request.getParameter("accountNo");
		String buyerName = request.getParameter("buyerName");
		String idCard = request.getParameter("idCard");
		String mobile = request.getParameter("mobile");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		CsairReturnValue returnValue = webClient.orderPageYzm(accountNo, buyerName, idCard, mobile);
		return returnValue;
	}
	
	/**
	 * 订单支付页面信用卡获取验证码
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "xykPayOrderYzm", method = RequestMethod.POST)
	@ResponseBody
	public CsairReturnValue xykPayOrderYzm(HttpServletRequest request, HttpSession session) {
		log.info("=============信用卡获取验证码==================");
		String accountNo = request.getParameter("accountNo");
		String EXPIREMONTH = request.getParameter("EXPIREMONTH");
		String EXPIREYEAR = request.getParameter("EXPIREYEAR");
		String cvv = request.getParameter("cvv");
		String buyerName = request.getParameter("buyerName");
		String idCard = request.getParameter("idCard");
		String mobile = request.getParameter("mobile");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		CsairReturnValue returnValue = webClient.xykPayOrderYzm(accountNo,EXPIREMONTH,EXPIREYEAR,cvv, buyerName, idCard, mobile);
		return returnValue;
	}

	/**
	 * 借记卡执行支付
	 * 
	 * @param request
	 * @param session
	 */
	@RequestMapping(value = "queryAndPayOrder", method = RequestMethod.POST)
	@ResponseBody
	public CsairReturnValue pay(HttpServletRequest request, HttpSession session) {
		log.info("================借记卡执行支付===================");
		String codeName = request.getParameter("codeName");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		CsairReturnValue returnValue = webClient.orderPayment(codeName);
		return returnValue;
	}
	
	
	/**
	 * 信用卡执行支付
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "xykQueryAndPayOrder", method = RequestMethod.POST)
	@ResponseBody
	public CsairReturnValue xykQueryAndPayOrder(HttpServletRequest request, HttpSession session) {
		log.info("====================信用卡执行支付=======================");
		String codeName = request.getParameter("codeName");
		String expiremonth = request.getParameter("expiremonth");
		String expireyear = request.getParameter("expireyear");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		CsairReturnValue returnValue = webClient.xykQueryAndPayOrder(codeName,expiremonth,expireyear);
		return returnValue;
	}
	
	/**
	 * 支付成功
	 * @return
	 */
	@RequestMapping(value = "paySuccess" , method = RequestMethod.GET)
	@ResponseBody
	public ModelAndView paySuccess() {
		log.info("==========================支付成功===========================");
		return new ModelAndView("csair/paySuccess");
	}
	
	/**
	 * 加载退票页面
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "refund", method = RequestMethod.GET)
	public ModelAndView refund(HttpServletRequest request, HttpSession session) {
		log.info("=================加载退票页面====================");
		Map<String, Object> map = new HashMap<String, Object>();
		String orderNo = request.getParameter("orderNo");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.refund(orderNo,session);
		return new ModelAndView("csair/refund2", map);
	}
	
	/**************************************************************************************/
	@RequestMapping(value = "refund111", method = RequestMethod.GET)
	public ModelAndView refund( HttpSession session) {
		log.info("=================加载退票页面(ceshi)====================");
		Map<String, Object> map = new HashMap<String, Object>();
		String url111 = "http://b2c.csair.com/B2C40/modules/services/refund/applyRefund.jsp?orderNo=C1807190011202";
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.refund111(url111);
		return null;
	}
	
	/*****************************************************************************************/
	
	
	/**
	 * 退票点击下一步
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "refundNext", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> refundNext(HttpServletRequest request, HttpSession session) {
		log.info("=================退票点击下一步====================");
		Map<String, Object> map = new HashMap<String, Object>();
		String refundtype = request.getParameter("refundtype");
		String beizhu = request.getParameter("beizhu");
		try {
			refundtype = URLDecoder.decode(refundtype,"UTF-8");
			beizhu = URLDecoder.decode(beizhu,"UTF-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.refundNext(refundtype,beizhu,session);
		return map;
	}
	
	/**
	 * 退票最后页面
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
//	@RequestMapping(value = "refundFinal", method = RequestMethod.GET)
//	public ModelAndView refundFinal() {
//		log.info("=================跳转退票最后页面====================");
//		Map<String, Object> map = new HashMap<String, Object>();
//		return new ModelAndView("csair/refundFinal", map);
//	}
	/**
	 * 退票最后页面
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
//	@RequestMapping(value = "refundFinal", method = RequestMethod.POST)
//	@ResponseBody
//	public Map<String, Object> refundFinal(HttpServletRequest request, HttpSession session) {
//		log.info("=================退票最后页面====================");
//		Map<String, Object> map = new HashMap<String, Object>();
//		
//		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
//		map = webClient.refundFinal(session);
//		return map;
//	}
	
	

	/**
	 * 加载变更页面
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "change", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> change1(HttpServletRequest request, HttpSession session) {
		log.info("=================加载变更页面1====================");
		Map<String, Object> map = new HashMap<String, Object>();
		String orderNo = request.getParameter("orderNo");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.change1(orderNo,session);
		return  map;
	}
	/**
	 * 加载变更页面
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "change", method = RequestMethod.GET)
	public ModelAndView change(HttpServletRequest request, HttpSession session) {
		log.info("=================加载变更页面====================");
		Map<String, Object> map = new HashMap<String, Object>();
		String orderNo = request.getParameter("orderNo");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.change(orderNo,session);
		return new ModelAndView("csair/change2", map);
	}
	
	/**
	 * 变更点击下一步
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "changeNext", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> changeNext(HttpServletRequest request, HttpSession session) {
		log.info("=================变更点击下一步====================");
		Map<String, Object> map = new HashMap<String, Object>();
		String[] ars = request.getParameterValues("ar[]");
		String changeType = request.getParameter("changeType");
		String beizhu = request.getParameter("beizhu");
		try {
			changeType = URLDecoder.decode(changeType,"UTF-8");
			beizhu = URLDecoder.decode(beizhu,"UTF-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		List<ChangeDate> list = new ArrayList<ChangeDate>();
		for (int i = 0; i < ars.length; i++) {
			String[] split = ars[i].split("#");
			
			ChangeDate d = new ChangeDate();
			d.setYear(split[0]);// 年
			d.setMonth(split[1]);// 月
			d.setDay(split[2]);// 日
			list.add(d);
//			log.info("p=======>" + p);
		}
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.changeNext(list,changeType,beizhu,session);
		return map;
	}
	
	
	/**
	 * 加载变更页面3
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "loadChange3", method = RequestMethod.GET)
	public ModelAndView loadChange3(HttpServletRequest request, HttpSession session) {
		log.info("=================加载变更页面3====================");
		Map<String, Object> map = new HashMap<String, Object>();
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.loadChange3(session);
		return new ModelAndView("csair/change3", map);
	}
	
	/**
	 * 变更页面change3航班信息
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "change3ChangeFlightInfo", method = RequestMethod.GET)
	public ModelAndView change3ChangeFlightInfo(HttpServletRequest request, HttpSession session) {
		log.info("=================变更页面change3航班信息====================");
		Map<String, Object> map = new HashMap<String, Object>();
		String id = request.getParameter("id");
		String mark = request.getParameter("mark");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.change3ChangeFlightInfo(id,mark,session);
		return new ModelAndView("csair/change3FlightInfo", map);
	}
	
	/**
	 * 变更change3点击下一步
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "change3Next", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> change3Next(HttpServletRequest request, HttpSession session) {
		log.info("=================变更change3点击下一步====================");
		Map<String, Object> map = new HashMap<String, Object>();
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.change3Next(session);
		return map;
	}
	
	/**
	 * 加载变更页面4
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "loadChange4", method = RequestMethod.GET)
	public ModelAndView loadChange4(HttpServletRequest request, HttpSession session) {
		log.info("=================加载变更页面3====================");
		Map<String, Object> map = new HashMap<String, Object>();
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.loadChange4(session);
		return new ModelAndView("csair/change4", map);
	}
	
	
	/**
	 * 变更change4点击下一步
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "change4Next", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> change4Next(HttpServletRequest request, HttpSession session) {
		log.info("=================变更change3点击下一步====================");
		Map<String, Object> map = new HashMap<String, Object>();
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.change4Next(session);
		return map;
	}
	
	/**
	 * 加载变更支付页面
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "payForChange", method = RequestMethod.GET)
	public ModelAndView payForChange(HttpServletRequest request, HttpSession session) {
		log.info("=================加载变更支付页面====================");
		Map<String, Object> map = new HashMap<String, Object>();
		String changeNo = request.getParameter("changeNo");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		map = webClient.payForChange(changeNo);
		return new ModelAndView("csair/payForChange", map);
	}
	
	
	/**
	 * 变更单支付页面借记卡获取验证码
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "payChangeYzm", method = RequestMethod.POST)
	@ResponseBody
	public CsairReturnValue payChangeYzm(HttpServletRequest request, HttpSession session) {
		log.info("=================借记卡获取验证码===================");
		String accountNo = request.getParameter("accountNo");
		String buyerName = request.getParameter("buyerName");
		String idCard = request.getParameter("idCard");
		String mobile = request.getParameter("mobile");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		CsairReturnValue returnValue = webClient.payChangeYzm(accountNo, buyerName, idCard, mobile);
		return returnValue;
	}
	
	
	/**
	 * 变更单支付页面信用卡获取验证码
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "xykPayChangeYzm", method = RequestMethod.POST)
	@ResponseBody
	public CsairReturnValue xykPayChangeYzm(HttpServletRequest request, HttpSession session) {
		log.info("=============信用卡获取验证码==================");
		String accountNo = request.getParameter("accountNo");
		String EXPIREMONTH = request.getParameter("EXPIREMONTH");
		String EXPIREYEAR = request.getParameter("EXPIREYEAR");
		String cvv = request.getParameter("cvv");
		String buyerName = request.getParameter("buyerName");
		String idCard = request.getParameter("idCard");
		String mobile = request.getParameter("mobile");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		CsairReturnValue returnValue = webClient.xykPayChangeYzm(accountNo,EXPIREMONTH,EXPIREYEAR,cvv, buyerName, idCard, mobile);
		return returnValue;
	}
	
	/**
	 * 变更单借记卡执行支付
	 * 
	 * @param request
	 * @param session
	 */
	@RequestMapping(value = "queryAndPayChange", method = RequestMethod.POST)
	@ResponseBody
	public CsairReturnValue queryAndPayChange(HttpServletRequest request, HttpSession session) {
		log.info("================借记卡执行支付===================");
		String codeName = request.getParameter("codeName");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		CsairReturnValue returnValue = webClient.queryAndPayChange(codeName);
		return returnValue;
	}

	
	/**
	 * 变更页面信用卡执行支付
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "xykQueryAndPayChange", method = RequestMethod.POST)
	@ResponseBody
	public CsairReturnValue xykQueryAndPayChange(HttpServletRequest request, HttpSession session) {
		log.info("====================信用卡执行支付=======================");
		String codeName = request.getParameter("codeName");
		String expiremonth = request.getParameter("expiremonth");
		String expireyear = request.getParameter("expireyear");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		CsairReturnValue returnValue = webClient.xykQueryAndPayChange(codeName,expiremonth,expireyear);
		return returnValue;
	}
	
	/**
	 * 加载里程支付页面
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "payLCOrder", method = RequestMethod.GET)
	public ModelAndView payLCOrder(HttpServletRequest request, HttpSession session) {
		log.info("=================加载里程支付页面====================");
		Map<String, Object> map = new HashMap<String, Object>();
		String orderNo = request.getParameter("orderNo");
//		String chuliTime1 = request.getParameter("chuliTime1");
//		String nanhangTime1 = request.getParameter("nanhangTime1");
//		String chuliTime2 = request.getParameter("chuliTime2");
//		String nanhangTime2 = request.getParameter("nanhangTime2");
//		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
//		map = webClient.goPayPage(orderNo);
		map.put("orderNo", orderNo);
//		map.put("chuliTime1", chuliTime1);
//		map.put("nanhangTime1", nanhangTime1);
//		map.put("chuliTime2", chuliTime2);
//		map.put("nanhangTime2", nanhangTime2);
		return new ModelAndView("csair/payForLC", map);
	}
	
	/**
	 * 加载支付页面订单信息
	 */
	@RequestMapping(value = "loadLCPayFilightInfo", method = RequestMethod.GET)
	public ModelAndView loadLCPayFilightInfo(HttpSession session, HttpServletRequest request) {
		log.info("===================加载支付页面订单信息===================");
		String orderNo = request.getParameter("orderNo");
//		String chuliTime1 = request.getParameter("chuliTime1");
//		String nanhangTime1 = request.getParameter("nanhangTime1");
//		String chuliTime2 = request.getParameter("chuliTime2");
//		String nanhangTime2 = request.getParameter("nanhangTime2");
		log.info("orderNo====>"+orderNo);
//		log.info("chuliTime1====>"+chuliTime1);
//		log.info("nanhangTime1====>"+nanhangTime1);
//		log.info("chuliTime2====>"+chuliTime2);
//		log.info("nanhangTime2====>"+nanhangTime2);
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		Map<String , Object> map = webClient.loadLCPayFilightInfo(orderNo);
//		if(map == null || map.get("nanhangTime3") == null || map.get("chuliTime3") == null  ){
//			log.info("页面加载时间存在null!");
//			Map<String , Object> map1 = new HashMap<String, Object>();
//			map1.put("Time3","网络速度慢，请重新操作！");
//			return new ModelAndView("csair/payFlightInfo2", map1);
//		}
//		double nanhangTime3 = (double) map.get("nanhangTime3");
//		double chuliTime3 = (double) map.get("chuliTime3");
//		map.put("Time1","无障碍处理旅客信息页面填写内容,跳转支付链接用时:"+ chuliTime1+"s,等待南航官网返回成功状态用时:"+nanhangTime1+"s");
//		map.put("Time2","等待南航官网加载订单详情用时:"+ nanhangTime2+"s,无障碍获取订单号用时:"+chuliTime2+"s");
//		map.put("Time3","等待南航官网加载支付页用时:"+ nanhangTime3+"s,无障碍处理用时:"+chuliTime3+"s");
		return new ModelAndView("csair/LCpayFlightInfo", map);
	}
	
	/**
	 * 里程订单支付页面信用卡获取验证码
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "xykPayLCOrderYzm", method = RequestMethod.POST)
	@ResponseBody
	public CsairReturnValue xykPayLCOrderYzm(HttpServletRequest request, HttpSession session) {
		log.info("=============里程支付信用卡获取验证码==================");
		String accountNo = request.getParameter("accountNo");
		String EXPIREMONTH = request.getParameter("EXPIREMONTH");
		String EXPIREYEAR = request.getParameter("EXPIREYEAR");
		String cvv = request.getParameter("cvv");
		String buyerName = request.getParameter("buyerName");
		String idCard = request.getParameter("idCard");
		String mobile = request.getParameter("mobile");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		CsairReturnValue returnValue = webClient.xykPayLCOrderYzm(accountNo,EXPIREMONTH,EXPIREYEAR,cvv, buyerName, idCard, mobile);
		return returnValue;
	}
	
	/**
	 * 里程订单支付页面借记卡获取验证码
	 * 
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "payLCOrderYzm", method = RequestMethod.POST)
	@ResponseBody
	public CsairReturnValue payLCOrderYzm(HttpServletRequest request, HttpSession session) {
		log.info("=================里程支付借记卡获取验证码===================");
		String accountNo = request.getParameter("accountNo");
		String buyerName = request.getParameter("buyerName");
		String idCard = request.getParameter("idCard");
		String mobile = request.getParameter("mobile");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		CsairReturnValue returnValue = webClient.payLCOrderYzm(accountNo, buyerName, idCard, mobile);
		return returnValue;
	}
	
	/**
	 * 里程支付信用卡执行支付
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping(value = "xykQueryAndPayLCOrder", method = RequestMethod.POST)
	@ResponseBody
	public CsairReturnValue xykQueryAndPayLCOrder(HttpServletRequest request, HttpSession session) {
		log.info("====================里程支付信用卡执行支付=======================");
		String codeName = request.getParameter("codeName");
		String expiremonth = request.getParameter("expiremonth");
		String expireyear = request.getParameter("expireyear");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		CsairReturnValue returnValue = webClient.xykQueryAndPayLCOrder(codeName,expiremonth,expireyear);
		return returnValue;
	}
	
	/**
	 * 里程兑换借记卡执行支付
	 * 
	 * @param request
	 * @param session
	 */
	@RequestMapping(value = "queryAndPayLCOrder", method = RequestMethod.POST)
	@ResponseBody
	public CsairReturnValue queryAndPayLCOrder(HttpServletRequest request, HttpSession session) {
		log.info("================里程兑换借记卡执行支付===================");
		String codeName = request.getParameter("codeName");
		Csair webClient = (CsairImpl) session.getAttribute(Csair.WEBCLIENT);
		CsairReturnValue returnValue = webClient.queryAndPayLCOrder(codeName);
		return returnValue;
	}
}
